package com.example.common.entity;

import java.math.BigInteger;
import java.util.Objects;
import java.io.Serializable;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.persistence.ManyToOne;
import lombok.Data;

/*
 * id for sys_roles_depts
 */
@Embeddable
@Data
public class SysRolesDeptsId implements Serializable {
    @Column(name = "role_id")
    private BigInteger roleId;
    @Column(name = "dept_id")
    private BigInteger deptId;
    
    public SysRolesDeptsId() {}
    
    public SysRolesDeptsId(BigInteger roleId, BigInteger deptId) {
        this.roleId = roleId;
        this.deptId = deptId;
    }
    
    public void setRoleId(BigInteger roleId) {
        this.roleId = roleId;
    }
    
    public void setDeptId(BigInteger deptId) {
        this.deptId = deptId;
    }
    
    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        SysRolesDeptsId sysDeptId = (SysRolesDeptsId) o;
        return Objects.equals(roleId, sysDeptId.roleId)
                   && Objects.equals(deptId, sysDeptId.deptId);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(roleId, deptId);
    }
}
